module hand_merge #(
	parameter CHL = 2
)(
	input      [CHL -1:0] s_valid,
	output reg [CHL -1:0] s_ready,
	
	output m_valid,
	input  m_ready
);

genvar i;
genvar j;
generate
	for(i=0; i<CHL; i=i+1)begin
		for(j=0; j<CHL; j=j+1)begin
			always @* begin
				s_ready[i] = m_ready;
				if(i != j)begin
					s_ready[i] = m_ready & s_valid[j];
				end
			end
		end
	end
endgenerate

assign m_valid = (&s_valid);

endmodule